import requestTest from '@/utils/testCar'

const prefix = "/api/SysUser"

import CryptoJS from 'crypto-js';
// const encrypted = CryptoJS.MD5(text).toString();
const sign = (text) => {
    const da = CryptoJS.MD5(text).toString()
    const ba = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(da));
    return ba
}
export function userTestCar(params) {
    return requestTest({
        url: 'http://172.18.40.210/evo-apigw/ipms/parkinglot/query',
        method: 'get',
        header: {
            'Content-Type': 'application/json',
            // 'appId':113,
            // timestamp: new Date().getTime(),
            // 'sign':sign('113'+'72f795a0758944fdb850b1c669dc6e0f'+new Date().getTime())
        },
        params: params
    })
}


export function ticketData(params) {
    return requestTest({
        url: `https://cas.ndky.edu.cn/authserver/serviceValidate?ticket=${params.ticket}&service=http://10.88.110.107:8001`,
        method: 'get',
        header: {
            'Content-Type': 'application/json',
            // 'appId':113,
            // timestamp: new Date().getTime(),
            // 'sign':sign('113'+'72f795a0758944fdb850b1c669dc6e0f'+new Date().getTime())
        },
        params: params
    })
}

export function depTestData(params) {
    return requestTest({
        url: 'https://cdsp.ndky.edu.cn/cdsp/data-api/v2/DS0008',
        method: 'get',
        header: {
            'Content-Type': 'application/json',
            'appId':113,
            timestamp: new Date().getTime(),
            'sign':sign('113'+'72f795a0758944fdb850b1c669dc6e0f'+new Date().getTime())
        },
        params: params
    })
}



// export function userInfo(userId,endId) {
// 	return request({
// 		url: prefix + '/info/'+ userId + '/' + endId,
// 		method: 'get'
// 	})
// }

export function userInfo(userId) {
    return request({
        url: prefix + '/info/'+ userId ,
        method: 'get'
    })
}
